#include"head.h"
void* puts_thread(void *arg){
args*args_puts=(args*)arg;
int sockfd=args_puts->sockfd;
 TLV *tlv = args_puts->TLV_t;
 TLV*tlv_ask=tlv;
tlv_ask->length=0;
TLV*TLV_RECV=(TLV*)malloc(sizeof(TLV));
memset(TLV_RECV,0,sizeof(TLV));
printf("子线程文件传输信息，讯问过程length=%d，token=%s,username=%s\n",tlv_ask->length,tlv_ask->token,tlv_ask->username);
sendTlv(sockfd,tlv_ask);
recvTlv(sockfd,TLV_RECV);
if(TLV_RECV->type==0xff){
printf("服务端不同意传输,返回信息为%s\n",TLV_RECV->value);
}
else{
    printf("服务端同意传输,返回信息为%s\n",TLV_RECV->value);
//sendfile(sockfd,tlv->value);
}
free(tlv);
free(tlv_ask);
return 0;
}
 void* gets_thread(void *arg){
   args*args_gets=(args*)arg;
   int sockfd=args_gets->sockfd;
    TLV *tlv = args_gets->TLV_t;
    TLV*tlv_ask=tlv;
   tlv_ask->length=0;TLV*TLV_RECV=(TLV*)malloc(sizeof(TLV));
   memset(TLV_RECV,0,sizeof(TLV));
  printf("子线程文件传输信息，讯问过程length=%d，token=%s,username=%s\n",tlv_ask->length,tlv_ask->token,tlv_ask->username);
  sendTlv(sockfd,tlv_ask);
  recvTlv(sockfd,TLV_RECV);
  if(TLV_RECV->type==0xff){
  printf("服务端不同意下载,返回信息为%s\n",TLV_RECV->value);
  }
  else{
      printf("服务端同意下载,返回信息为%s\n",TLV_RECV->value);
  //sendfile(sockfd,tlv->value);
 }
  free(tlv);
  free(tlv_ask);
  return 0;
  }

